<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Return an array of printers attached to the server</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.printer-get-option.html">printer_get_option</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.printer-logical-fontheight.html">printer_logical_fontheight</a></div>
 <div class="up"><a href="ref.printer.html">Printer 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.printer-list" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">printer_list</h1>
  <p class="verinfo">(PECL printer SVN)</p><p class="refpurpose"><span class="refname">printer_list</span> &mdash; <span class="dc-title">Return an array of printers attached to the server</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.printer-list-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">array</span> <span class="methodname"><strong>printer_list</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$enumtype</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$level</code></span>
  ]] )</div>

  <p class="para rdfs-comment">
   The function enumerates available printers and their capabilities.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.printer-list-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">enumtype</code></em></dt>

     <dd>

      <p class="para">
       <em><code class="parameter">enumtype</code></em> must be one of the following predefined
       constants:
       <ul class="itemizedlist">
        <li class="listitem">
         <span class="simpara">
          <strong><code>PRINTER_ENUM_LOCAL</code></strong>:
          enumerates the locally installed printers.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>PRINTER_ENUM_NAME</code></strong>:
          enumerates the printer of <em><code class="parameter">name</code></em>, can be a server,
          domain or print provider.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>PRINTER_ENUM_SHARED</code></strong>:
          this parameter can&#039;t be used alone, it has to be OR&#039;ed with other
          parameters, i.e. <strong><code>PRINTER_ENUM_LOCAL</code></strong> to detect the locally shared
          printers.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>PRINTER_ENUM_DEFAULT</code></strong>:
          (Win9.x only) enumerates the default printer.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>PRINTER_ENUM_CONNECTIONS</code></strong>:
          (WinNT/2000 only) enumerates the printers to which the user has
          made connections.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>PRINTER_ENUM_NETWORK</code></strong>:
          (WinNT/2000 only) enumerates network printers in the computer&#039;s
          domain. Only valid if <em><code class="parameter">level</code></em> is 1.
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code>PRINTER_ENUM_REMOTE</code></strong>:
          (WinNT/2000 only) enumerates network printers and print servers in the
          computer&#039;s domain. Only valid if <em><code class="parameter">level</code></em> is 1.
         </span>
        </li>
       </ul>
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">name</code></em></dt>

     <dd>

      <p class="para">
       Used with <strong><code>PRINTER_ENUM_NAME</code></strong>.
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">level</code></em></dt>

     <dd>

      <p class="para">
       <em><code class="parameter">level</code></em> sets the level of information request.
       Can be 1,2,4 or 5.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.printer-list-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Return an array of printers.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.printer-list-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-5256">
    <p><strong>Example #1 <span class="function"><strong>printer_list()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*&nbsp;detect&nbsp;locally&nbsp;shared&nbsp;printer&nbsp;*/<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">printer_list</span><span style="color: #007700">(</span><span style="color: #0000BB">PRINTER_ENUM_LOCAL&nbsp;</span><span style="color: #007700">|&nbsp;</span><span style="color: #0000BB">PRINTER_ENUM_SHARED</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>

 
</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.printer-get-option.html">printer_get_option</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.printer-logical-fontheight.html">printer_logical_fontheight</a></div>
 <div class="up"><a href="ref.printer.html">Printer 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
